package com.phone.exception;

/**
 * Created by tisen on 2017/8/3.
 */
public class ParameterException extends Exception {
    public static final int PARAMETER_IS_EMPTY = 1;
    public static final int PARAMETER_IS_WRONG = 2;
    public static final int PARAMETER_FORMAT_WRONG = 3;

    private String error_message = "parameter error";


    public ParameterException(int type, String key) {
        switch (type) {
            case PARAMETER_IS_EMPTY:
                error_message = "Parameter " + key + " is empty";
                break;
            case PARAMETER_IS_WRONG:
                error_message = "Parameter " + key + " is wrong";
                break;
            case PARAMETER_FORMAT_WRONG:
                error_message = "Parameter " + key + " format wrong";
                break;
            default:
                break;
        }
    }

    @Override
    public String getMessage() {
        return error_message;
    }

}
